package com.sg.hms.controller;

import java.io.IOException;
import java.io.Writer;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sg.hms.Service.RoomService;
import com.sg.hms.ServiceImpl.RoomServiceImpl;
/***
 * 获得房间编号
 * @author 吴磊
 *
 */
public class GetRidController extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		req.setCharacterEncoding("UTF-8");
	   RoomService room=new RoomServiceImpl();
	   String rName=req.getParameter("menpai");
	   int temp=room.getRidByRname(rName);
	   Writer writer=resp.getWriter();
	   writer.write(String.valueOf(temp));
	   writer.flush();
	   writer.close();
	}

}
